// Fill out your copyright notice in the Description page of Project Settings.


#include "StateMachine/PlayerState/FallState.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "Core/Character2D.h"
#include "StateMachine/StateMachine.h"
#include "StateMachine/PlayerState/GroundState.h"
#include "StateMachine/PlayerState/IdleState.h"

void UFallState::Init(APlayerController* Controller, ACharacter2D* Player, UStateMachine* SM)
{
	Super::Init(Controller, Player, SM);
	MovementComp = Character->GetCharacterMovement();
}

void UFallState::Enter()
{
	Super::Enter();
	Character->PlayAnimation(FName("Fall"));
	
}

void UFallState::Exit()
{
	Super::Exit();
}

void UFallState::Tick(float Delta)
{
	Super::Tick(Delta);
	if (MovementComp->IsWalking())
	{
		StateMachine->SwitchState(UIdleState::StaticClass());
	}
}

void UFallState::InputSignal(EInputSignal Signal, const FInputActionValue& Value)
{
	Super::InputSignal(Signal, Value);
}
